const connection = require("../db/connection")
const input = require("scanline")

async function deleteAll() {
    const yn = await input("你确定要删除全部信息吗(y确认/n取消)")
    if(yn ==="y" || yn ==="Y"){
        connection.query("truncate table sp",(error,_)=>{
            if(error){
                console.log("删除全部商品信息失败",error)
                process.exit(1)
            }
            console.log("你已删除全部商品信息");
        })
    }else{
        console.log("你已取消该操作");
    }
    connection.end()
}

module.exports = deleteAll


